package com.coderside.fragment.Reference;

import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public class Foo {
	public static void main(String[] args) throws Exception {
		Method[] methods = Foo.class.getDeclaredMethods();
		for (Method method : methods) {
			System.out.println(" returnType: ");
			Type returnType = method.getGenericReturnType();
			if (returnType instanceof ParameterizedType) {
				Type types = ((ParameterizedType) returnType).getRawType();
				if (types ==Collection.class) {
					System.out.println(types);
				}
			}
			System.out.println(" paramTypeType: ");
			Type[] paramTypeList = method.getGenericParameterTypes();
			for (Type paramType : paramTypeList) {
				if (paramType instanceof ParameterizedType) {
					Type[] types = ((ParameterizedType) paramType).getActualTypeArguments();
					for (Type type : types) {
						System.out.println(type);
					}
				}
			}
		}
	}

	public static List<String> test3(String list) {
		return null;
	}

	private static Map<String, Double> test4(Map<String, Object> map) {
		return null;
	}

}